package io.adminboot.web;


import io.adminboot.entity.User;
import io.adminboot.system.annotation.Login;
import io.adminboot.system.annotation.LoginUser;
import io.adminboot.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * APP测试接口
 */
@RestController
@RequestMapping("/app")
@Api("APP测试接口")
public class AppTestController {

    @Login
    @GetMapping("userInfo")
    @ApiOperation("获取用户信息")
    public R userInfo(
            @RequestHeader(value = "token") String token,
            @LoginUser User user) {
        return R.ok().put("user", user);
    }

    @Login
    @GetMapping("profile")
    @ApiOperation("获取用户个人资料")
    public R userInfo(@RequestHeader(value = "token") String token) {
        return R.ok().put("userId", "aaaaa");
    }

    @GetMapping("notToken")
    @ApiOperation("忽略Token验证测试")
    public R notToken() {
        return R.ok().put("msg", "无需token也能访问。。。");
    }

}
